/**
 * uni page
 * @returns {AxiosPromise}
 */

import request from '@/util/request'

// home
export function homePage() {
  return request({
    url: '/api/uni/home/index',
    method: 'get'
  })
}

// home num
export function homeNum() {
  return request({
    url: '/api/uni/home/num',
    method: 'get'
  })
}

export function homeTip() {
  return request({
    url: '/api/uni/tip/index',
    method: 'get'
  })
}

// group
export function groupPage() {
  return request({
    url: '/api/uni/group/index',
    method: 'get'
  })
}

// merchant
export function merchantPage() {
  return request({
    url: '/api/uni/merchant/index',
    method: 'get'
  })
}

// cart
export function cartPage() {
  return request({
    url: '/api/uni/cart/index',
    method: 'get'
  })
}

// center
export function centerPage() {
  return request({
    url: '/api/uni/center/index',
    method: 'get'
  })
}

// 获取头像
export function getAvatar(data) {
  return request({
    url: '/api/uni/center/get-avatar',
    method: 'post',
    data
  })
}

// 修改头像
export function setAvatar(data) {
  return request({
    url: '/api/uni/center/set-avatar',
    method: 'post',
    data
  })
}

export function delAvatar(data) {
  return request({
    url: '/api/uni/center/del-avatar',
    method: 'post',
    data
  })
}

// category
export function categoryPage() {
  return request({
    url: '/api/uni/category/index',
    method: 'get'
  })
}

// ----------------------------------------

// 改版首页

export function getGoProduct() {
  return request({
    url: '/api/go-home/product',
    method: 'get'
  })
}

export function getGoNews() {
  return request({
    url: '/api/go-home/news',
    method: 'get'
  })
}

// ----------------------------------------

// 素材库
export function getMaterial(data) {
  return request({
    url: '/api/uni/material/list',
    method: 'post',
    data
  })
}
